/* Copyright (c) 2007-2012, ben "boin" bonoeil */

#ifndef _HL2DEMO_PARSER_H_
#define _HL2DEMO_PARSER_H_

#include "externc.h"
#include "hl2demo_defs.h"
#include <stdio.h>

/** skip values to be use with hl2demo_parser(). */
enum {
  PARSER_SKIP_NONE = 0,         /**< Keep all. */
  PARSER_SKIP_ALL  = -1,        /**< Skip all. */
  PARSER_SKIP_DATA = 1,         /**< Skip data block. */
};

/** parser callback function. */
typedef int (*hl2demo_parser_cb_t)(hl2demo_message_t *, void *);

/** Get error message. */
EXTERN_C const char * hl2demo_get_error(void);

/** Read demo file header. */
EXTERN_C int hl2demo_header_read(hl2demo_header_t * hd, FILE * inp);

/** Parse demo file. */
EXTERN_C int hl2demo_parser(hl2demo_t * dm, FILE * inp, int skip);

/** Set parser callback. */
EXTERN_C void hl2demo_parser_callback(hl2demo_parser_cb_t fct, void * cookie);

#endif /* #ifndef _HL2DEMO_PARSER_H_ */
